﻿using System.Collections.Generic;

namespace Lucid.ESA.ClientDataSystem.Domain.Common
{
    /// <summary>
    /// Repository contract: for persisting an entity.
    /// </summary>
    public interface IRepository<T> 
    {
        /// <summary>
        /// Saves an entity if it is new, or updates it if it is old.
        /// </summary>
        /// <param name="obj">The entity to save or update.</param>
        void SaveOrUpdate(T obj);

        void Save(T obj);

        /// <summary>
        /// Gets the entity with the specified ID.
        /// </summary>
        /// <param name="id">The ID of the entity to return.</param>
        /// <returns>The entity with the specified ID.</returns>
        T GetById(long id);

        /// <summary>
        /// Loads a proxy for an entity with the specified ID.
        /// </summary>
        /// <param name="id">The ID of the proxy of the entity to return.</param>
        /// <returns>A proxy of the entity with the specified ID.</returns>
        T LoadById(long id);

        /// <summary>
        /// Gets all entities.
        /// </summary>
        /// <returns>List of all entities.</returns>
        List<T> GetAll();
    }
}